<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
   <?php echo $this->breadCrumbs(); ?>
  </div>
  <?php if (isset($error_warning)) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/information.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
      <div class="buttons">
      	<a onclick="$('#form').submit();" class="button"><?php echo $_['button_save']; ?></a>
      	<a onclick="location = '<?php echo UA('catalog/faq'); ?>';" class="button"><?php echo $_['button_cancel']; ?></a>
      </div>
    </div>
    <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="form">
          <tr>
            <td><span class="required">*</span> <?php echo $_['entry_author']; ?></td>
            <td><input type="text" name="author" value="<?php echo $vo->get('author'); ?>" />
              <?php echo form_error('author') ?></td>
          </tr>
          <tr>
            <td><?php echo $_['entry_product']; ?></td>
            <td><input type="text" name="product" value="<?php echo $vo->get('product'); ?>" />
              <input type="hidden" name="product_id" value="<?php echo $vo->get('product_id'); ?>" />
              <?php echo form_error('product_id') ?></td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo $_['entry_question']; ?></td>
            <td><textarea name="question" cols="60" rows="8"><?php echo $vo->get('question'); ?></textarea>
              <?php echo form_error('question') ?></td>
          </tr>
		  <tr>
            <td><?php echo $_['entry_answer']; ?></td>
            <td><textarea name="answer" cols="60" rows="8"><?php echo $vo->get('answer'); ?></textarea>
            </td>
          </tr> 
          <tr>
            <td><?php echo $_['entry_status']; ?></td>
            <td><select name="status">
				<?php echo form_select_option($_['option_statuses'], $vo->get('status'), true); ?>
              </select></td>
          </tr>
        </table>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('input[name=\'product\']').autocomplete({
	delay: 500,
	source: function(request, response) {
		$.ajax({
			url: '<?php echo UA('catalog/product/autocomplete'); ?>&filter_name=' +  encodeURIComponent(request.term),
			dataType: 'json',
			success: function(json) {		
				response($.map(json, function(item) {
					return {
						label: item.name,
						value: item.product_id
					}
				}));
			}
		});
	},
	select: function(event, ui) {
		$('input[name=\'product\']').val(ui.item.label);
		$('input[name=\'product_id\']').val(ui.item.value);
		
		return false;
	},
	focus: function(event, ui) {
      	return false;
   	}
});
//--></script> 
<?php echo $footer; ?>